<?php
/**
 * Created by PhpStorm.
 * User: wangjiangtao
 * Date: 2022/5/25
 * Time: 15:39
 */

namespace App\Http\Controllers\Api;


use App\Model\AdminLog;
use App\Model\Activity;
use App\Model\OperationLogs;
use Illuminate\Http\Request;

class ActivityController extends BaseController
{

    protected $model = null;
    /**
     * @param Request $request
     */
    public function __construct(Request $request)
    {
        parent::__construct($request);
        $this->model = new Activity();
    }

    //周星榜配置新增
    public function getGiftstarConfigAdd(Request $request){
        $res = $this->model->getGiftstarConfigAdd($request->all());
        if(is_array($res)) {
            return $this->toJson(self::ERROR, [], $res['msg']);
        }
        OperationLogs::createData($request, OperationLogs::ACTIVITY, '周星榜配置新增');
        return $this->toJson(self::SUCCESS);
    }

    //周星榜配置删除
    public function getGiftstarConfigDelete(Request $request){
        $res = $this->model->getGiftstarConfigDelete($request->all());
        if(is_array($res)) {
            return $this->toJson(self::ERROR, [], $res['msg']);
        }
        OperationLogs::createData($request, OperationLogs::ACTIVITY, '周星榜配置删除');
        return $this->toJson(self::SUCCESS);
    }

    //获取周星榜配置列表
    public function getGiftstarConfigList(Request $request){
        return $this->toJson(self::SUCCESS, $this->model->getGiftstarConfigList($request->all()));
    }

    //获取周星榜发放奖励列表
    public function getGiftstarRewardList(Request $request){
        return $this->toJson(self::SUCCESS, $this->model->getGiftstarRewardList($request->all()));
    }

    //获取周星榜统计列表
    public function getGiftstarStatisticsList(Request $request){
        return $this->toJson(self::SUCCESS, $this->model->getGiftstarStatisticsList($request));
    }

    //邀请活动每日用户邀请贡献明细
    public function getInvite202310DayStatList(Request $request){
        return $this->toJson(self::SUCCESS, $this->model->getInvite202310DayStatList($request));
    }
    public function getInvite202310DayStatListExport(Request $request){
        return $this->toJson(self::SUCCESS, $this->model->exportInvite202310DayStatList($request));
    }
    //邀请活动解绑
    public function changeMoveInviteCode(Request $request){
        return $this->toJson(self::SUCCESS, $this->model->changeMoveInviteCode($request));
    }
    //邀请活动绑定
    public function changeBindInviteCode(Request $request){
        return $this->toJson(self::SUCCESS, $this->model->changeBindInviteCode($request));
    }

    //邀请活动三期每日钻石分成用户明细
    public function getInvite202310DayDiamondList(Request $request){
        return $this->toJson(self::SUCCESS, $this->model->getInvite202310DayDiamondList($request));
    }

}
